Learning Objectives

After completing this lesson, you'll be able to:

Resources

Introduction

You are working on a workspace to let users translate a Geodatabase into a format of their choice. In an earlier exercise, we built the workspace using a generic writer and a user parameter so the end user could choose the format.

However, that workspace had a limitation: every output dataset included all the source table attributes. It would also be helpful if that workspace could handle any source Geodatabase, not just the community maps dataset.

So, let's use dynamic reader and writer feature types to make these improvements.

1) Start Workbench

Start FME Workbench (2022.1 or later) and click Generate Workspace. Fill in the dialog as follows:

Reader Format Esri Geodatabase (File Geodb Open API)
Reader Dataset https://s3.amazonaws.com/FMEData/FMEData/Data/CommunityMapping/CommunityMap.gdb.zip or C:\FMEData\Data\CommunityMapping\CommunityMap.gdb
Writer Format Generic (Any Format)
Writer Dataset C:\FMEData\Output\Training
Writer Parameters Output Format: Esri Shapefile
Workflow Options Dynamic Schema

The dynamic schema parameter is essential to handle all aspects of the source schema for input datasets.

2) Inspect Workspace

Inspect the newly created workspace:

Generated workspace

There is one reader feature type and one writer feature type. The reader feature type shows a list of attributes if you expand it (via the right-pointing arrow), but the writer feature type doesn't. It is, however, labeled <Dynamic>.

As in the previous exercise, there will be a user parameter for the Feature Types to Read and the Output Format.

If you wish, create a more-limited version of the output format parameter by following steps 3-5 in the previous exercise, although this isn't necessary for what we're doing here.

But don't delete the SourceDataset_FILEGDB user parameter; we'll need that shortly.

3) Run Workspace

Run the workspace with Prompt for User Parameters enabled.

When prompted, select some source tables from Feature Types to Read (any will do) and set the output format (again, any will do, though note that some will produce nonsensical output if you haven't limited the options). The workspace will run to completion. Check the output to ensure it is correct.

4) Rerun Workspace

Now rerun the workspace.

Be sure to use the option to Rerun Entire Workspace (Shift+F5):

Rerun Entire Workspace option

Otherwise, FME would use cached data in preference to the actual source data, which is not what we want.

Note

Choosing Run Workspace (F5) would be characterized by the lack of source (File Geodatabase) parameter in the Translation Parameter Values dialog. So if the source parameter is missing from the prompts, you likely chose Run Workspace instead of Rerun Entire Workspace.

When prompted, enter https://s3.amazonaws.com/FMEData/FMEData/Data/Addresses.zip for the File Geodatabase parameter (or click the browse button and browse to C:\FMEData\Data\Addresses\Addresses.gdb).

Clear the Feature Types to Read parameter and click Run to rerun the workspace.

Inspect the output. Notice that the output feature types (PostalAddress and PostcodeBoundaries) are all as listed in the original data. Also, notice that the attributes are the same as in the original.

From this result, we can see that a dynamic workspace can handle any source schema and write it out to a new dataset just as it was in the source data.